import {Component, OnInit} from '@angular/core';

@Component({
    selector: 'app-translate',
    templateUrl: './translate.component.html',
    styleUrls: ['./translate.component.less']
})
export class TranslateComponent implements OnInit {
    public languages: string;
    public translateValue: string;
    public translateResult: string;

    constructor() {
        this.languages = 'auto/zh/';
    }

    ngOnInit() {
    }
    keyDown(e) {
        if (e.keyCode === 13) {
        }
    }
    toBaiDu() {
        let url = 'https://fanyi.baidu.com/?aldtype=16047#' + this.languages;
        if (this.translateValue) {
            url = url + this.translateValue;
        }
        window.open(url);
    }
    toYouDao() {
        const url = 'http://fanyi.youdao.com/';
        window.open(url);
    }
}
